package cn.tedu.sp02.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import pojo.Item;
import service.ItemService;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Service
public class ItemServiceImpl implements ItemService {

    @Override
    public List<Item> getItems(String orderId) {
        // 模拟查询到了商品的列表
        List<Item> items = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            items.add(new Item(i, "商品" + i, i));
        }
        return items;
    }

    @Override
    public void decreaseNumbers(List<Item> list) {
        // 模拟减少库存
        for (Item item : list) {
            log.info("商品：{} 减少了 {} 件库存",item.getName(),item.getCount());
        }
    }

}
